﻿// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;

namespace Azure.AI.DocumentIntelligence
{
    public partial class ClassifyDocumentOptions
    {
        // CUSTOM CODE NOTE: since either UriSource or BytesSource must be specified
        // when building this object, we're hiding its parameterless constructor, adding
        // custom constructors, and making both properties readonly.

        /// <summary>
        /// Initializes a new instance of <see cref="ClassifyDocumentOptions"/>.
        /// </summary>
        /// <param name="classifierId"> Unique document classifier name. </param>
        /// <param name="uriSource"> Document URL to analyze. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="classifierId"/> or <paramref name="uriSource"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="classifierId"/> is an empty string, and was expected to be non-empty. </exception>
        public ClassifyDocumentOptions(string classifierId, Uri uriSource)
        {
            Argument.AssertNotNullOrEmpty(classifierId, nameof(classifierId));
            Argument.AssertNotNull(uriSource, nameof(uriSource));

            ClassifierId = classifierId;
            UriSource = uriSource;
        }

        /// <summary>
        /// Initializes a new instance of <see cref="ClassifyDocumentOptions"/>.
        /// </summary>
        /// <param name="classifierId"> Unique document classifier name. </param>
        /// <param name="bytesSource">
        /// Bytes of the document to analyze.
        /// <para>
        /// To assign a byte[] to this property use <see cref="BinaryData.FromBytes(byte[])"/>.
        /// The byte[] will be serialized to a Base64 encoded string.
        /// </para>
        /// <para>
        /// Examples:
        /// <list type="bullet">
        /// <item>
        /// <term>BinaryData.FromBytes(new byte[] { 1, 2, 3 })</term>
        /// <description>Creates a payload of "AQID".</description>
        /// </item>
        /// </list>
        /// </para>
        /// </param>
        /// <exception cref="ArgumentNullException"> <paramref name="classifierId"/> or <paramref name="bytesSource"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="classifierId"/> is an empty string, and was expected to be non-empty. </exception>
        public ClassifyDocumentOptions(string classifierId, BinaryData bytesSource)
        {
            Argument.AssertNotNullOrEmpty(classifierId, nameof(classifierId));
            Argument.AssertNotNull(bytesSource, nameof(bytesSource));

            ClassifierId = classifierId;
            BytesSource = bytesSource;
        }

        internal ClassifyDocumentOptions()
        {
        }

        /// <summary>
        /// Unique document classifier name.
        /// </summary>
        public string ClassifierId { get; }

        // NOTE: keeping the internal setter so it doesn't break autogenerated samples.
        /// <summary> Document URL to classify. </summary>
        public Uri UriSource { get; internal set; }

        /// <summary>
        /// Bytes of the document to classify.
        /// <para>
        /// To assign a byte[] to this property use <see cref="BinaryData.FromBytes(byte[])"/>.
        /// The byte[] will be serialized to a Base64 encoded string.
        /// </para>
        /// <para>
        /// Examples:
        /// <list type="bullet">
        /// <item>
        /// <term>BinaryData.FromBytes(new byte[] { 1, 2, 3 })</term>
        /// <description>Creates a payload of "AQID".</description>
        /// </item>
        /// </list>
        /// </para>
        /// </summary>
        public BinaryData BytesSource { get; }

        /// <summary>
        /// Document splitting mode.
        /// </summary>
        public SplitMode? Split { get; set; }

        /// <summary>
        /// 1-based page numbers to analyze.  Ex. "1-3,5,7-9".
        /// </summary>
        public string Pages { get; set; }
    }
}
